&ANALYZE-SUSPEND _VERSION-NUMBER UIB_v9r12
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure 
/*------------------------------------------------------------------------
    File        : 
    Purpose     :

    Syntax      :

    Description :

    Author(s)   :
    Created     :
    Notes       :
  ----------------------------------------------------------------------*/
/*          This .W file was created with the Progress AppBuilder.      */
/*----------------------------------------------------------------------*/

/* ***************************  Definitions  ************************** */

DEF INPUT PARAMETER tl-nbcol        AS   INTEGER             NO-UNDO.
DEF INPUT PARAMETER tl-large        AS   CHARACTER           NO-UNDO.
DEF INPUT PARAMETER tl-aligne       AS   CHARACTER           NO-UNDO.
DEF INPUT PARAMETER tl-bgcol        AS   CHARACTER           NO-UNDO.
DEF INPUT PARAMETER tl-libel        AS   CHARACTER           NO-UNDO.
DEF INPUT PARAMETER tl-font         AS   CHARACTER           NO-UNDO.
DEF INPUT PARAMETER tl-size         AS   CHARACTER           NO-UNDO.
DEF INPUT PARAMETER tl-coul         AS   CHARACTER           NO-UNDO.
DEF INPUT PARAMETER tl-lien         AS   CHARACTER           NO-UNDO.

DEF            VAR sep              AS   CHARACTER INIT "~"" NO-UNDO.
DEF            VAR i                AS   INTEGER             NO-UNDO.



 /* Stream where we write all web output */
&IF DEFINED(WEBSTREAM) = 0 &THEN
  &GLOBAL-DEFINE WEBSTREAM STREAM WebStream
&ENDIF

/* Only define a stream if there's something to define */
&IF "{&WEBSTREAM}" <> "" &THEN
DEFINE {1} SHARED {&WEBSTREAM}.
&ENDIF

&GLOBAL-DEFINE OUT-STREAM PUT {&WEBSTREAM} UNFORMATTED
/* OUT-FILE is the same as OUT-STREAM, for now.  */
&GLOBAL-DEFINE OUT-FILE {&OUT-STREAM}
&GLOBAL-DEFINE OUT {&OUT-STREAM}
&GLOBAL-DEFINE OUT-FMT PUT {&WEBSTREAM}
&GLOBAL-DEFINE DISPLAY DISPLAY {&WEBSTREAM}
&GLOBAL-DEFINE END .

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK 

/* ********************  Preprocessor Definitions  ******************** */

&Scoped-define PROCEDURE-TYPE Procedure
&Scoped-define DB-AWARE no



/* _UIB-PREPROCESSOR-BLOCK-END */
&ANALYZE-RESUME


/* ************************  Function Prototypes ********************** */

&IF DEFINED(EXCLUDE-complete_liste) = 0 &THEN

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD complete_liste Procedure 
FUNCTION complete_liste RETURNS CHARACTER
  ( liste AS CHARACTER, nbcol AS INTEGER )  FORWARD.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ENDIF


/* *********************** Procedure Settings ************************ */

&ANALYZE-SUSPEND _PROCEDURE-SETTINGS
/* Settings for THIS-PROCEDURE
   Type: Procedure
   Allow: 
   Frames: 0
   Add Fields to: Neither
   Other Settings: CODE-ONLY COMPILE
 */
&ANALYZE-RESUME _END-PROCEDURE-SETTINGS

/* *************************  Create Window  ************************** */

&ANALYZE-SUSPEND _CREATE-WINDOW
/* DESIGN Window definition (used by the UIB) 
  CREATE WINDOW Procedure ASSIGN
         HEIGHT             = 15
         WIDTH              = 60.
/* END WINDOW DEFINITION */
                                                                        */
&ANALYZE-RESUME

 


&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure 


/* ***************************  Main Block  *************************** */

IF tl-nbcol > NUM-ENTRIES(tl-large)  THEN tl-large  = complete_liste(tl-large,tl-nbcol).
IF tl-nbcol > NUM-ENTRIES(tl-aligne) THEN tl-aligne = complete_liste(tl-aligne,tl-nbcol).
IF tl-nbcol > NUM-ENTRIES(tl-bgcol)  THEN tl-bgcol  = complete_liste(tl-bgcol,tl-nbcol).
IF tl-nbcol > NUM-ENTRIES(tl-font)   THEN tl-font   = complete_liste(tl-font,tl-nbcol).
IF tl-nbcol > NUM-ENTRIES(tl-size)   THEN tl-size   = complete_liste(tl-size,tl-nbcol).
IF tl-nbcol > NUM-ENTRIES(tl-coul)   THEN tl-coul   = complete_liste(tl-coul,tl-nbcol).
IF tl-nbcol > NUM-ENTRIES(tl-lien)   THEN tl-lien   = complete_liste(tl-lien,tl-nbcol).

{&out} "<tr>".

DO i = 1 TO tl-nbcol:

   {&out} SKIP  "<td".
    
   IF ENTRY(i,tl-large,"#")  <> "" THEN {&out} " width="   sep ENTRY(i,tl-large,"#")  sep.
   IF ENTRY(i,tl-aligne,"#") <> "" THEN {&out} " align="   sep ENTRY(i,tl-aligne,"#") sep.
   IF ENTRY(i,tl-bgcol)      <> "" THEN {&out} " bgcolor=" sep ENTRY(i,tl-bgcol)      sep.
   
   {&out} ">".
    
   IF ENTRY(i,tl-lien,"#")   <> "" THEN 
      {&out} "<a href=" sep ENTRY(i,tl-lien,"#") sep ">".
   
   {&out} "<b>".

   IF ENTRY(i,tl-font,"#") <> "" OR
      ENTRY(i,tl-size,"#") <> "" THEN DO:
      {&out} "<font".
      IF ENTRY(i,tl-font,"#") <> "" THEN {&out} " face="  sep ENTRY(i,tl-font,"#")  sep.
      IF ENTRY(i,tl-size,"#") <> "" THEN {&out} " size="  sep ENTRY(i,tl-size,"#")  sep.
      IF ENTRY(i,tl-coul)     <> "" THEN {&out} " color=" sep ENTRY(i,tl-coul)      sep.
      {&out} ">".
   END.

   IF ENTRY(i,tl-libel,"#") <> "" THEN {&out} ENTRY(i,tl-libel,"#").
   ELSE {&out} "&nbsp;".
   
   IF ENTRY(i,tl-font,"#") <> "" OR
      ENTRY(i,tl-size,"#") <> "" THEN {&out} "</font>".

   {&out} "</b>".
   IF ENTRY(i,tl-lien,"#")   <> "" THEN {&out} "</a>".
   {&out} "</td>" SKIP.

END.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


/* ************************  Function Implementations ***************** */

&IF DEFINED(EXCLUDE-complete_liste) = 0 &THEN

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION complete_liste Procedure 
FUNCTION complete_liste RETURNS CHARACTER
  ( liste AS CHARACTER, nbcol AS INTEGER ) :
/*------------------------------------------------------------------------------
  Purpose:  
    Notes:  
------------------------------------------------------------------------------*/

DEF VAR i AS INTEGER NO-UNDO.
DEF VAR temp    AS CHARACTER    NO-UNDO.
DEF VAR sep     AS CHARACTER    NO-UNDO.

  sep = IF liste BEGINS "#" THEN "," ELSE "#".


  temp = ENTRY(NUM-ENTRIES(liste),liste,sep).
  DO i = NUM-ENTRIES(liste,sep) TO nbcol - 1:
       liste = liste + sep + temp.
  END.

  RETURN liste.   /* Function return value. */

END FUNCTION.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ENDIF

